﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.out_storageList
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtmaterial_id.Text))
			{
				strErr+="物料表ID格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtout_storage_Estimate.Text))
			{
				strErr+="预计出库时间格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtout_storage_count.Text))
			{
				strErr+="出库数量格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtmaterial_user_id.Text))
			{
				strErr+="物料员(User表ID)格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtcheck_user_id.Text))
			{
				strErr+="审核人（User表ＩＤ）格式错误！\\n";	
			}
			if(this.txtcheck_status.Text.Trim().Length==0)
			{
				strErr+="审核状态不能为空！\\n";	
			}
			if(this.txtdeal_status.Text.Trim().Length==0)
			{
				strErr+="处理状态不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int material_id=int.Parse(this.txtmaterial_id.Text);
			DateTime out_storage_Estimate=DateTime.Parse(this.txtout_storage_Estimate.Text);
			decimal out_storage_count=decimal.Parse(this.txtout_storage_count.Text);
			int material_user_id=int.Parse(this.txtmaterial_user_id.Text);
			int check_user_id=int.Parse(this.txtcheck_user_id.Text);
			string check_status=this.txtcheck_status.Text;
			string deal_status=this.txtdeal_status.Text;

			lcs.Model.out_storageList model=new lcs.Model.out_storageList();
			model.material_id=material_id;
			model.out_storage_Estimate=out_storage_Estimate;
			model.out_storage_count=out_storage_count;
			model.material_user_id=material_user_id;
			model.check_user_id=check_user_id;
			model.check_status=check_status;
			model.deal_status=deal_status;

			lcs.BLL.out_storageList bll=new lcs.BLL.out_storageList();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","Add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
